Repository navigation
feat(strands-agents-sdk): upgrade to v1.62.0, fix context compression, add subagent, middleware and swarm examples - #87
Open
martimfasantos wants to merge 5 commits into
Open
martimfasantos wants to merge 5 commits into
martimfasantos wants to merge 5 commits into
Conversation
… example and docs links, and add subagent tool example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades Strands Agents from
1.55.1to1.62.0, fixes18_context_compression.py(it crashed on the new context-manager model), repoints every docs link after the strandsagents.com reorganisation, and adds examples for the new vendedsubagentandswarmtools and the public middleware API.What changed
Package upgrade
strands-agentsupgraded from1.55.1→1.62.0strands-agents-toolsupgraded from0.8.8→0.8.10pyproject.tomlfloors raised to match (were>=1.47.0/>=0.5.2)Existing examples updated
18_context_compression.pyAttributeErroron.summary_ratio.12_multi_agent_graph.pyset_execution_timeout(300.0). Since 1.60.0build()warns when a graph has no execution limit.For more detailslink returned 404.On
18: since 1.56.0,context_manager="auto"installs a strategy-basedContextManagerplugin and the agent'sconversation_managerbecomes aNullConversationManager. Section 6 also taught that an explicitconversation_manageroverridesauto; it is now ignored with a warning. Section 5 now shows whatauto/agenticactually register. Section 6 builds a pipeline from named presets plus a hand-pinnedOffload.summarize(...)strategy, and proves offloading happened: a 16,026-char tool result reached the model as a 4,120-char preview.On the URLs:
/user-guide/concepts/became/user-guide/sdk/, andquickstart/andobservability-evaluation/moved undersdk/. All 23 unique URLs were verified to return 200.New examples added
26_subagent_tool.pymake_subagent()with twoPresetroles, a modelChoicewhoseOptionvalues are model instances, a custombuilder, andmax_depth=127_middleware.pyagent.add_middleware()— anInvokeModelStage.Inputhandler adds a note to each call's system prompt, anOutputhandler logs stop reason and tokens, and anExecuteToolStageWrap handler blocksdelete_filewithout running it (0 executions, file still present)28_swarm_tool.pymake_swarm()withresearcher/writerpresets andinstructions=Fixed(); prints the team the model asked for and the streamed handoff path, ending in a 3-bullet answerKey changes in v1.55.1 → v1.62.0
ContextManager(1.56.0) — summarize / truncate / drop pipelines with four named presets;context_manager="auto"now uses it.handoff_to_userandmcp_routervended tools; Graph/Swarm session snapshots (1.57.0). Unknownlimitskeys now raiseTypeError.Agent.shutdown()andwith Agent(...)/async with Agent(...)(1.57.1) — flush memory on exit; newa2a_clienttool.strands.experimental.biditostrands.bidi.Agent(aux_model=...)(1.58.0) — routes side calls (summaries, memory extraction, goal judge) to a cheaper model.subagent/make_subagentvended tool with axis policies (1.59.0).python_replvended tool, namespaced stash storage and OTel baggage (1.60.0); OpenAI usage fixes, and graphs warn when built without an execution limit._metaand acontent_filteredstop reason (1.61.0).add_middleware) and aswarmvended tool (1.62.0);agent.cancel(message=, after_current_tools=), thestoptool moves tostrands.vended_tools, and an experimental OpenAI Live bidi provider.Notes
OPENAI_STRONG_MODEL_NAME(defaultgpt-4.1).26offers it as the "strong"Option; it is insettings.pyand.env.example.26passes its ownbuilderon purpose. The default builder only grants children tools the manager itself holds, so the manager would have the order tool and could skip delegating.28's model may omitagent_typefor an agent. An omitted preset falls back to the first one (researcher), as the captured run shows.20_human_in_the_loop.pyprints a new interrupt wording since 1.59.0 (Approve "transfer_funds"?). The code is unchanged and itsOUTPUTS.mdsection is left as captured.httpcore2shutdown traceback on stderr at exit. It predates this upgrade and the examples still exit 0.Configuration
gpt-4o-mini) viasettings.py;26also usesOPENAI_STRONG_MODEL_NAMEstrands-agents>=1.62.0,strands-agents-tools>=0.8.10,pydantic-settingsuvpackage managerTesting
All 29 examples ran with exit code 0 against v1.62.0.
OUTPUTS.mdupdated for the five touched files (12,18,26,27,28) plus the header; the other 24 sections are unchanged.uv lock --check,uv sync --frozenandpy_compilepass locally.